package com.example.liang.basamovie.json;
import com.example.liang.basamovie.bean.Recommend4;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class RecommendJson3 {
    public static List<Recommend4> getRecommend4(String info){
        try {
            JSONObject object = new JSONObject(info);
            JSONArray array = object.getJSONArray("infoList");
            List<Recommend4> list=new ArrayList<>();
            for (int i = 0; i <array.length() ; i++) {
                JSONObject object2 = array.getJSONObject(i);
                Recommend4 recommend4=new Recommend4();
                recommend4.setMonth(object2.optString("month"));
                recommend4.setDay(object2.optString("day"));
                JSONObject object3 = object2.getJSONObject("object");
                recommend4.setArticleContentUrl(object3.optString("articleContentUrl"));
                recommend4.setDescription(object3.optString("descriptionRecommend"));
                recommend4.setTitle(object3.optString("title"));
                recommend4.setImage_url(object3.optString("imageRecommend"));
                list.add(recommend4);
            }
            return list;
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }

}
